package com.scgaopan.disruptor.pakingdemo.producer;

import com.lmax.disruptor.EventTranslator;
import com.scgaopan.disruptor.pakingdemo.MyInParkingDataEvent;

/**
 * Author:scgaopan
 * Date:18/10/25
 * Description:
 */
public class MyInParkingDataEventTranslator implements EventTranslator<MyInParkingDataEvent> {


    public void translateTo(MyInParkingDataEvent myInParkingDataEvent, long sequence) {
        this.generateData(myInParkingDataEvent);
    }

    private MyInParkingDataEvent generateData(MyInParkingDataEvent myInParkingDataEvent) {
        myInParkingDataEvent.setCarLicense("车牌号： 鄂A-" + (int) (Math.random() * 100000)); // 随机生成一个车牌号
       // System.out.println("Thread Id " + Thread.currentThread().getId() + " 写完一个event");
        return myInParkingDataEvent;

    }
}
